﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:WK35705XML"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        x:Class="WK35705XML.MainWindow"
        Title="WK35705" Height="560.527" Width="1034.038" >
    <Window.Resources>
        <HierarchicalDataTemplate DataType = "{x:Type local:IHasChildren}"
                                ItemsSource = "{Binding ChildObjects}">
            <TextBlock Text="{Binding name}"/>
        </HierarchicalDataTemplate>

        <HierarchicalDataTemplate DataType = "{x:Type local:INode}">
            <TextBlock Text="{Binding name}"/>
        </HierarchicalDataTemplate>

    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="50*"/>
            <ColumnDefinition Width="50*"/>
        </Grid.ColumnDefinitions>
        <TreeView x:Name="View" Margin="10,41,10,10" ItemsSource="{Binding Umps.Items, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}"/>
        <Button Grid.Column="0" Content="Load XML" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click"/>
        <Button Grid.Column="0" Content="Save XML" HorizontalAlignment="Left" Margin="90,10,0,0" VerticalAlignment="Top" Width="75" Click="Save"/>

        <xctk:PropertyGrid Grid.Column="1" Margin="20,10,0,10" SelectedObject="{Binding SelectedValue, ElementName=View, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"></xctk:PropertyGrid>
        <Button Grid.Column="0" Content="Add UMP" HorizontalAlignment="Left" Margin="170,10,0,0" VerticalAlignment="Top" Width="75" Click="AddUMP"/>
     
    </Grid>
</Window>
